package com.seed.core.configuration.relation;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.seed.core.pojo.seed.Habtms;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class HabtmConfiguration extends HasManyConfiguration {
    protected String throughSeedName;
    protected String throughSelfColumn;
    protected String throughTargetColumn;

    public Habtms toHabtm() {
        Habtms ret = new Habtms();
        ret.setTargetSeedName(seedName);
        ret.setLabel(label);
        ret.setComment(comment);
        ret.setSelfColumn(selfColumn);
        ret.setTargetColumn(targetColumn);
        ret.setCascade(cascade);
        ret.setExtra(extra);

        ret.setLimit(limit);

        ret.setThroughSeedName(throughSeedName);
        ret.setThroughSelfColumn(throughSelfColumn);
        ret.setThroughTargetColumn(throughTargetColumn);

        return ret;
    }

    public HabtmConfiguration toFront() {
        HabtmConfiguration ret = new HabtmConfiguration();

        ret.setSeedName(seedName);
        ret.setLabel(label);
        ret.setComment(comment);
        ret.setSelfColumn(selfColumn);
        ret.setTargetColumn(targetColumn);

        ret.setThroughSeedName(throughSeedName);
        ret.setThroughSelfColumn(throughSelfColumn);
        ret.setThroughTargetColumn(throughTargetColumn);

        ret.setExtra(extra);

        return ret;
    }

    public String getThroughSeedName() {
        return throughSeedName;
    }

    public void setThroughSeedName(String throughSeedName) {
        this.throughSeedName = throughSeedName;
    }

    public String getThroughSelfColumn() {
        return throughSelfColumn;
    }

    public void setThroughSelfColumn(String throughSelfColumn) {
        this.throughSelfColumn = throughSelfColumn;
    }

    public String getThroughTargetColumn() {
        return throughTargetColumn;
    }

    public void setThroughTargetColumn(String throughTargetColumn) {
        this.throughTargetColumn = throughTargetColumn;
    }
}
